package com.example.patient.controller;

import com.example.common.support.Result;
import com.example.patient.dto.req.*;
import com.example.patient.dto.resp.*;
import com.example.patient.service.UserService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author wxy
 * @Date 2021/1/18 13:57
 * @Version 1.0
 */
@RestController
@Api(tags = "用户")
@RequestMapping("/Client/User")
public class UserController {
    @Resource
    private UserService userService;

    @ApiOperation(value = "医院服务电话", notes = "医院服务电话")
    @PostMapping(value = "/CenterData")
    public Result<Object> CenterData() {
        return Result.success(userService.CenterData());
    }

    @ApiOperation(value = "修改用户", notes = "修改用户")
    @PostMapping(value = "/SetUserInfo")
    public Result<Object> SetUserInfo(@RequestBody SetUserInfoReq req) {
        return Result.success(userService.SetUserInfo(req));
    }

    @ApiOperation(value = "关注医生列表", notes = "关注医生列表")
    @PostMapping(value = "/DCRelationLists")
    public Result<PageInfo<DCRelationListsResp>> DCRelationLists(@RequestBody DCRelationListsReq req) {
        return Result.success(userService.DCRelationLists(req));
    }

    @ApiOperation(value = "就诊人列表", notes = "就诊人列表")
    @PostMapping(value = "/PatientLists")
    public Result<Map<String, Object>> PatientLists(@RequestBody PageReq req) {
        return Result.success(userService.PatientLists(req));
    }

    @ApiOperation(value = "短信验证", notes = "短信验证")
    @PostMapping(value = "/PatientSendSMS")
    public Result<Object> PatientSendSMS(@RequestBody PatientSendSMSReq req) {
        return Result.success(userService.PatientSendSMS(req));
    }

    @ApiOperation(value = "就诊人详情", notes = "就诊人详情")
    @PostMapping(value = "/PatientDetail")
    public Result<PatientDetailResp> PatientDetail(@RequestBody PatientDetailReq req) {
        return Result.success(userService.PatientDetail(req));
    }

    @ApiOperation(value = "提交就诊人", notes = "提交就诊人")
    @PostMapping(value = "/SubmitPatient")
    public Result<Object> SubmitPatient(@RequestBody SubmitPatientReq req) {
        return Result.success(userService.SubmitPatient(req));

    }

    @ApiOperation(value = "删除就诊人", notes = "删除就诊人")
    @PostMapping(value = "/DelPatient")
    public Result<Object> DelPatient(@RequestBody DelPatientReq req) {
        return Result.success(userService.DelPatient(req));
    }

    @ApiOperation(value = "地址管理列表", notes = "地址管理列表")
    @PostMapping(value = "/AddressLists")
    public Result<List<AddressListsResp>> AddressLists() {
        return Result.success(userService.AddressLists());
    }

    @ApiOperation(value = "地址详情", notes = "地址详情")
    @PostMapping(value = "/AddressDetail")
    public Result<AddressDetailResp> AddressDetail(@RequestBody AddressDetailReq req) {
        return Result.success(userService.AddressDetail(req));
    }

    @ApiOperation(value = "添加和修改地址", notes = "添加和修改地址")
    @PostMapping(value = "/SaveAddress")
    public Result<Object> SaveAddress(@RequestBody SaveAddressReq req) {
        return Result.success(userService.SaveAddress(req));
    }

    @ApiOperation(value = "删除地址", notes = "删除地址")
    @PostMapping(value = "/DelAddress")
    public Result<Object> DelAddress(@RequestBody DelAddressReq req) {
        return Result.success(userService.DelAddress(req));
    }

    @ApiOperation(value = "随访列表", notes = "随访列表")
    @PostMapping(value = "/MyFollowrList")
    public Result<List<MyFollowrListResp>> MyFollowrList() {
        return Result.success(userService.MyFollowrList());
    }

    @ApiOperation(value = "随访详情", notes = "随访详情")
    @PostMapping(value = "/MyFollowrDetail")
    public Result<MyFollowrDetailResp> MyFollowrDetail(@RequestBody MyFollowrDetailReq req) {
        return Result.success(userService.MyFollowrDetail(req));
    }
}
